/**
 * 
 */
package de.mbenning.fsim.domain;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;

import org.hibernate.annotations.CollectionOfElements;
import org.hibernate.annotations.IndexColumn;

/**
 * @author Martin.Benning
 *
 */
@Entity
@Table (name = "LIGA")
public class Liga implements Serializable {

	private static final long serialVersionUID = -7158516797247128703L;
	
	@Id
	@GeneratedValue (strategy = GenerationType.TABLE)
	@Column (name = "ID",updatable = false, nullable = false)
	private Integer id;
	
	@Column (name = "NAME", length = 50, unique = true)
	private String name;
	
	@ManyToOne (fetch = FetchType.EAGER)
	@JoinColumn (name = "LAND_ID")
	private Land land;
	
	@Column (name = "ANZAHL")
	private Integer anzahlVereine = new Integer(18);
	
	@OneToMany (cascade = CascadeType.PERSIST, fetch = FetchType.LAZY)
	private List<Saison> saisons = new ArrayList<Saison>();

	public Liga() {
	}

	public Liga(String name, Land land) {
		this.name = name;
		this.land = land;
	}
	
	public Integer getId() {
		return id;
	}

	public void setId(Integer id) {
		this.id = id;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public Land getLand() {
		return land;
	}

	public void setLand(Land land) {
		this.land = land;
	}

	public Integer getAnzahlVereine() {
		return anzahlVereine;
	}

	public void setAnzahlVereine(Integer anzahlVereine) {
		this.anzahlVereine = anzahlVereine;
	}

	public List<Saison> getSaisons() {
		return saisons;
	}

	public void setSaisons(List<Saison> saisons) {
		this.saisons = saisons;
	}
	
}
